home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / AVOGADRO / CHEMISTRY / MOLEDRAW / !MoleDraw / docs / mdobjs < prev    next >
Text File  |  1995-12-24  |  4KB  |  143 lines

  1. /*
  2.    mdobjs.h  -  data used in MoleDraw files
  3.  
  4.    This header file is 'Freeware'. You may do anything with it (in part or
  5.    as a whole) except sell it or remove this message.
  6.  
  7.    (c) Simon Kilvington, 1994.
  8. */
  9.  
  10. #ifndef __mdobjs_h__
  11. #define __mdobjs_h__
  12.  
  13. /*
  14.    A MoleDraw file is a DrawFile with a connection table object. Each bond
  15.    is a tagged object, the extra data is used to identify the atoms it
  16.    connects. Each atom label is another type of tagged object with similar
  17.    data associated with it.
  18.    Two other tagged objects are used. Aromatic ring objects, these are the
  19.    circles at the centre of aromatic rings, and are used when writing SMILES
  20.    strings. Finally, arrow head objects, these are tagged so they can be
  21.    altered by the 'Style' menu.
  22.    The DrawFile object number and the tag numbers are registered with Acorn.
  23. */
  24.  
  25. /* standard RISC OS Lib definitions; we only use 'draw_objhdr' in here */
  26. #include "drawftypes.h"
  27.  
  28. /* connection table's DrawFile object type */
  29.  
  30. #define md_CONTABLEOBJ     0x1C0
  31.  
  32. /* tagged objects and data associated with them */
  33.  
  34. #define md_BONDTAG         0x800
  35. #define md_LABELTAG        0x801
  36. #define md_AROMATICRINGTAG 0x802
  37. #define md_ARROWHEADTAG    0x803
  38.  
  39. typedef struct
  40. {
  41.    int atom1;        /* the two atoms it connects */
  42.    int atom2;        /* atom2 > atom1 */
  43. } md_bondtagdata;
  44.  
  45. typedef struct
  46. {
  47.    int atom;         /* atom no. (ie it's index in the connection table) */
  48. } md_labeltagdata;
  49.  
  50. /* no data associated with aromatic ring objects */
  51.  
  52. typedef struct
  53. {
  54.    int style;        /* in 'Arrow heads' menu order, first style is 0 */
  55. } md_arrowheadtagdata;
  56.  
  57. /* types of bonds */
  58.  
  59. typedef char md_bondtype;
  60.  
  61. #define BONDTYPE_Line         (md_bondtype) 0x0;      /* no special features */
  62. #define BONDTYPE_Dash         (md_bondtype) 0x1;
  63. #define BONDTYPE_Bold         (md_bondtype) 0x2;
  64. #define BONDTYPE_BoldDash     (md_bondtype) 0x3;
  65. #define BONDTYPE_WedgeOut     (md_bondtype) 0x4;
  66. #define BONDTYPE_WedgeOutDash (md_bondtype) 0x5;
  67. #define BONDTYPE_WedgeIn      (md_bondtype) 0x6;
  68. #define BONDTYPE_WedgeInDash  (md_bondtype) 0x7;
  69. #define BONDTYPE_Wiggle       (md_bondtype) 0x8;
  70. #define BONDTYPE_CentredBit   (md_bondtype) 0x10;
  71. /* CentredBit only applies to double bonds, it is either off or on */
  72.  
  73. /* allowed bond orders */
  74.  
  75. typedef char md_bondorder;
  76.  
  77. #define BONDORDER_NoBond (md_bondorder) 0;
  78. #define BONDORDER_Single (md_bondorder) 1;
  79. #define BONDORDER_Double (md_bondorder) 2;
  80. #define BONDORDER_Triple (md_bondorder) 3;
  81.  
  82. /* label positions */
  83.  
  84. typedef char md_labeltype;
  85.  
  86. #define LABELTYPE_None   (md_labeltype) 0;  /* this atom not labeled */
  87. #define LABELTYPE_Dot    (md_labeltype) 1;  /* labeled with a dot, not text */
  88. #define LABELTYPE_Left   (md_labeltype) 2;  /* atom at leftmost char in text */
  89. #define LABELTYPE_Centre (md_labeltype) 3;
  90. #define LABELTYPE_Right  (md_labeltype) 4;
  91. #define LABELTYPE_Above  (md_labeltype) 5;  /* label is vertical, above atom */
  92. #define LABELTYPE_Below  (md_labeltype) 6;
  93.  
  94. /* arrow head styles */
  95.  
  96. #define ARROWHEAD_Filled     (int) 0;
  97. #define ARROWHEAD_FilledHalf (int) 1;
  98. #define ARROWHEAD_Open       (int) 2;
  99. #define ARROWHEAD_OpenHalf   (int) 3;
  100. /* more may be added later, however these 4 will not change */
  101.  
  102. /* connection table data structures */
  103.  
  104. #define md_MAXBONDS  8         /* max atoms that an atom can be bonded to */
  105. #define md_MAXORDER  3         /* max number of bonds between two atoms */
  106.  
  107. #define md_NOBOND   -1         /* used in bondedto[] arrays */
  108.  
  109. /* data stored about each atom in connection table */
  110.  
  111. typedef struct
  112. {
  113.    int          x, y;                          /* in Draw coords */
  114.    int          bondedto[md_MAXBONDS];         /* atoms it's connected to, md_NOBOND => no bond */
  115.    md_bondorder bondorder[md_MAXBONDS];        /* bondorder[B] only valid if bondedto[B]!=md_NOBOND */
  116.    md_bondtype  btype[md_MAXBONDS][md_MAXORDER];
  117.    md_labeltype ltype;
  118.    char         reserved[3];
  119. } md_atomdetails;
  120.  
  121. /* and a whole connection table */
  122.  
  123. typedef struct
  124. {
  125.    draw_objhdr    hdr;         /* bbox is set to 0,0,0,0 */
  126.    int            natoms;
  127.    md_atomdetails atom[1];     /* array extends to atom[natoms-1] */
  128. } md_connectiontable;
  129.  
  130. #define md_CONTABHDRSIZE (sizeof(md_connectiontable) - sizeof(md_atomdetails))
  131.  
  132. /* some things missing from drawftypes.h */
  133.  
  134. #define draw_OBJTAGGED  7
  135.  
  136. typedef struct
  137. {
  138.    draw_objhdr hdr;
  139.    int         tag;
  140. } draw_taggedobjhdr;
  141.  
  142. #endif
  143.